package com.jswl.training.springjpa.config;

import com.jswl.training.springjpa.entity.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

//Configuration 表示该类是一个配置类,以前需要在xml配置一些bean等可以直接在下面注册
@Configuration
@Slf4j
public class MyConfig {

    //1.给容器添加组件,组件默认以方法名作为组件ID
    //2.也可以指定名称
    @Bean(value ="userFan")
    public User userFan(){
        User user = new User();
        user.setAge(30);
        user.setPhone("15010752230");
        user.setClassId(1L);
        return user;
    }


}
